/**
 * Copyright (c) 2016-2019 九点科技 All rights reserved.
 *
 * http://www.9dyun.cn
 *
 * 版权所有，侵权必究！
 */
package com.dian.modules.sale.controller;

import java.util.Map;
import java.util.List;
import com.dian.common.annotation.SysLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.dian.common.controller.AbstractController;
import com.dian.modules.sale.entity.InstallFinishEntity;
import com.dian.modules.sale.service.InstallFinishService;
import com.dian.modules.sale.vo.InstallFinishExportVO;
import com.dian.common.utils.PageUtils;
import com.dian.common.utils.R;


/**
 * 安装完工单
 *
 * @author xiaolai
 * @email xiaolai@9dyun.cn
 * @date 2019-06-21 15:24:30
 */
@RestController
@Api("安装完工单接口")
@RequestMapping("sale/installFinish")
public class InstallFinishController extends AbstractController{
    @Autowired
    private InstallFinishService installFinishService;

    /**
     * 安装完工单列表
     */
    @SysLog("安装完工单列表")
    @GetMapping("/list")
    @ApiOperation("安装完工单列表")
    @RequiresPermissions("sale:installFinish:list")
    public R list(@RequestParam Map<String, Object> params){

        PageUtils page = installFinishService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 安装完工单信息
     */
    @SysLog("安装完工单信息")
    @ApiOperation("安装完工单信息")
    @GetMapping("/info/{id}")
    @RequiresPermissions("sale:installFinish:info")
    public R info(@PathVariable("id") Long id){

        InstallFinishEntity installFinish = installFinishService.getInfo(id);

        return R.ok().put(installFinish);
    }

    /**
     * 安装完工单保存
     */
    @SysLog("安装完工单保存")
    @ApiOperation("安装完工单保存")
    @PostMapping("/save")
    @RequiresPermissions("sale:InstallFinish:save")
    public R save(@RequestBody InstallFinishEntity installFinish){

		installFinishService.saveInfo(installFinish);

        return R.ok();
    }

    /**
     * 安装完工单修改
     */
    @SysLog("安装完工单修改")
    @ApiOperation("安装完工单修改")
    @PostMapping("/update")
    @RequiresPermissions("sale:installFinish:update")
    public R update(@RequestBody InstallFinishEntity installFinish){

		installFinishService.updateInfo(installFinish);

        return R.ok();
    }

    /**
     * 安装完工单删除
     */
    @SysLog("安装完工单删除")
    @ApiOperation("安装完工单删除")
    @PostMapping("/delete")
    @RequiresPermissions("sale:installFinish:delete")
    public R delete(@RequestBody Long[] ids){

		installFinishService.deleteInfo(ids);

        return R.ok();
    }

/*
    *//**
     * 安装完工单审核
     *//*
    @SysLog("安装完工单审核")
    @ApiOperation("安装完工单审核")
    @GetMapping("/check/{id}")
    @RequiresPermissions("sale:installFinish:check")
    public R check(@PathVariable("id") Long id){

        installFinishService.checkInfo(id);

        return R.ok();
    }*/


    /**
     * 安装完工单导出
     */
    @SysLog("安装完工单导出")
    @ApiOperation("安装完工单导出")
    @GetMapping("/export")
    @RequiresPermissions("sale:installFinish:export")
    public void export(@RequestParam Map<String, Object> params){

        List<InstallFinishExportVO> list = installFinishService.exportList(params);

        exportExcel(list,"安装完工单","安装完工单",InstallFinishExportVO.class,"安装完工单.xls");
    }

}
